package com.example.goodrubish.Garbage;

import com.example.goodrubish.Fragment.SearchFragment;

import org.json.JSONException;
import org.json.JSONObject;

public class Garbage_list {
    private JSONObject search_result= SearchFragment.Search_JSON;
    private String name;
    private int garbage_type;           //0是可回收，1是有害垃圾，2是厨余垃圾，3是其它垃圾
    private String[] garbage_type_string={"可回收垃圾","有害垃圾","厨余垃圾","其它垃圾"};

    public Garbage_list(JSONObject the_garbage_JSON) throws JSONException {
        name=the_garbage_JSON.getString("name");
        garbage_type=Integer.parseInt(the_garbage_JSON.getString("type"));
    }

    public String getName(){
        return name;
    }

    public String getType(){
        return garbage_type_string[garbage_type];
    }
}

